package model;

import java.util.StringJoiner;
import java.util.function.Consumer;

/**
 * @Author: xwg
 * @CreateDate: 2023/4/9
 */


public class ClickEvent {
    public String target = "div";
    //    public Integer eventX;
    //    public Integer eventY;
    public Integer eventXY = 100;

//    这一个属性只在理解异步时使用
    public Runnable eventListener = () -> {
    };

    @Override
    public String toString() {
        return new StringJoiner(", ", ClickEvent.class.getSimpleName() + "[", "]")
                .add("target='" + target + "'")
                .add("eventXY=" + eventXY)
                .toString();
    }

    public ClickEvent(String target, Integer eventXY) {
        this.target = target;
        this.eventXY = eventXY;
    }

    public ClickEvent(String target, Integer eventXY, Runnable eventListener) {
        this.target = target;
        this.eventXY = eventXY;
        this.eventListener = eventListener;
    }
}
